﻿#region 命名空间

using System;
using System.Collections;
using System.Collections.Generic;
using Sharp.Domain.PlatformBoundedContext.PermissionModule.Aggregates;
using Sharp.Domain.PlatformBoundedContext.UserModule.Aggregates;
using Sharp.Infrastructure;

#endregion

namespace Sharp.Domain.PlatformBoundedContext.UserModule.Services
{
    /// <summary>
    ///     表示继承于该接口的类型都是领域服务（Domain Service）类型。
    /// </summary>
    public partial interface IUserService
    {
        /// <summary>
        /// 记录登录信息
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        Result<User> TryLogin(User user);

      

        /// <summary>
        ///     获取用户的权限
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        IEnumerable<Permission> GetPermissionByUserName(string username);

        /// <summary>
        ///     获取用户的权限
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        IEnumerable<Permission> GetPermissionById(int uid);


        /// <summary>
        ///     保存权限
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="owner"></param>
        /// <param name="ownerId"></param>
        Result SavePermission(IList<Guid> ids, string owner, int ownerId);

        /// <summary>
        ///     将指定的用户赋予特定的角色。
        /// </summary>
        /// <param name="userIds"></param>
        /// <param name="roleId"></param>
        Result AssignRole(int[] userIds, int roleId);


        /// <summary>
        /// 关联用户到角色
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="roleIds"></param>
        /// <returns></returns>
        Result RelationUser(int userId, int[] roleIds);

        /// <summary>
        /// 刷新用户授权数据
        /// </summary>
        /// <param name="userid"></param>
        Result RefurbishUserPermissionData(int userid);

        /// <summary>
        /// 更新可用权限的数据
        /// </summary>
        /// <param name="dtos"></param>
        /// <param name="columns"></param>
        /// <returns></returns>
        Result RefurbishAvailablePermissionData(IList<AvailablePermission> dtos, string columns);

        /// <summary>
        /// 保存可用权限到权限列表
        /// </summary>
        /// <param name="ids"></param>
        Result AvailablePermissionToPermission(Guid[] ids);
        /// <summary>
        /// 分配所有权限给超级管理员角色
        /// </summary>
        /// <returns></returns>
        Result AllotAllPermissionToAdminRole();
        /// <summary>
        /// 保存组织结构数据权限
        /// </summary>
        /// <returns></returns>
        Result SaveOrgPermission(Guid[] orgIds, int roleId);

        /// <summary>
        /// 关联用户到工作组
        /// </summary>
        /// <param name="groupId"></param>
        /// <param name="userIds"></param>
        /// <returns></returns>
        Result RelationUserForGroup(int groupId, int[] userIds);


        /// <summary>
        /// 根据角色获取用户列表
        /// </summary>
        /// <param name="roleIDs">多个角色ID</param>
        /// <returns>用户列表</returns>
        IList<User> GetUserListByRoles(int[] roleIDs);
        /// <summary>
        /// 根据接收者类型，来获取角色用户树的数据
        /// receiverType 参数说明
        /// 默认:0
        /// 上司:1
        /// 同事:2
        /// 下属:3
        /// </summary>
        /// <param name="roleIDs">角色ID</param>
        /// <param name="runnerUserId">用户ID</param>
        /// <param name="receiverType">接收者类型</param>
        /// <returns>用户列表</returns>
        IList<User> GetUserListByRoleReceiverType(int[] roleIDs, string runnerUserId, int receiverType);
    }
}